-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable file-backed caching on webGL platform #37
Disable file-backed caching on webGL platform #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do an in-depth review yet, but I want to say that I like the abstraction you added for cache 💜
Utilities.Rest/Packages/com.utilities.rest/Runtime/Interfaces/IDownloadCache.cs
Outdated
Show resolved
Hide resolved
I commented on one of your commits but it seems the messages has disappeared. So I will write it again. I wanted to know why you want to keep the code from the "revert some cache checks" commit (5fa6946). In concrete implementation of the DownloadCache does already check if an item is cached or not, and is doing the exact same check with an early return: // From DiskDownloadCache.cs: public bool TryGetDownloadCacheItem(string uri, out string filePath)
{
ValidateCacheDirectory();
bool exists;
if (uri.Contains(Rest.FileUriPrefix))
{
filePath = uri;
return File.Exists(uri.Replace(Rest.FileUriPrefix, string.Empty));
}
} I would argue that it should be up to the DownloadCache to decide if an item is cached or not. |
It was a breaking change and the early check actually was needed to prevent unintended behavior changes to existing packages. |
Oh, got you. Good that you spotted that then! |
Hey @StephenHodgson,
as mentioned on discord the current implementation of the DownloadCache was running into trouble on the webGL platform.
With the changes I implemented here I tried to separate the caching so that the DownloadCache can be replaced depending on the platforms needs.
I originally wanted the DownloadCache to already return the assets instead of just returning the URLs to load, so that on webGL there could be a runtime-cache for the textures and audioClips. I decided against that for now, because I would have needed to change more of your existing code which I don't wanna do without your consent.
Would be glad if these changes will go live promptly.